/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import DTO.HistorialDTO;
import DTO.usuarioDTO;
import com.toedter.calendar.JDateChooser;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import jxl.biff.drawing.ComboBox;

/**
 *
 * @author SoftGroup
 */
public class Historial extends javax.swing.JFrame {
    
    usuarioDTO user;
    public Historial(usuarioDTO user) {
        this.user = user;
        initComponents();
        rdbTipo.setSelected(true);
        EstadoControles(cmbTipo, null, null, null);
        TablaInicial();
        this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
        
    }
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jDateDesde = new com.toedter.calendar.JDateChooser();
        jDateHasta = new com.toedter.calendar.JDateChooser();
        rdbFecha = new javax.swing.JRadioButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jtInfo = new javax.swing.JTable();
        btnVolverMenu = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        rdbTipo = new javax.swing.JRadioButton();
        cmbTipo = new javax.swing.JComboBox();
        jPanel4 = new javax.swing.JPanel();
        rdbAccion = new javax.swing.JRadioButton();
        cmbAccion = new javax.swing.JComboBox();
        jPanel5 = new javax.swing.JPanel();
        rdbUsuario = new javax.swing.JRadioButton();
        txtUsuario = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        rdbPerfil = new javax.swing.JRadioButton();
        cmbPerfil = new javax.swing.JComboBox();
        btnListar = new javax.swing.JButton();
        lblLogo = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jPanel1.setFocusCycleRoot(true);
        jPanel1.setFocusable(false);
        jPanel1.setName(""); // NOI18N

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "FECHAS", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        jLabel2.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel2.setText("DESDE");

        jLabel3.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel3.setText("HASTA");

        jDateDesde.setDateFormatString("yyyy-MM-dd");

        jDateHasta.setDateFormatString("yyyy-MM-dd");

        buttonGroup1.add(rdbFecha);
        rdbFecha.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdbFechaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(rdbFecha)
                .addGap(14, 14, 14)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jDateDesde, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jDateHasta, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(rdbFecha, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jDateDesde, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel3)
                    .addComponent(jDateHasta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jtInfo.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jtInfo.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "CODIGO", "USER", "NOMBRE USUARIO", "PERFIL", "ACCION", "TIPO", "FECHA ", "FECHA VENCIMIENTO", "FOLIO_INGRESADO", "RUT_INGRESADO"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class, java.lang.Object.class, java.lang.Integer.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jtInfo.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        jtInfo.getTableHeader().setResizingAllowed(false);
        jtInfo.getTableHeader().setReorderingAllowed(false);
        jScrollPane2.setViewportView(jtInfo);

        btnVolverMenu.setText("VOLVER");
        btnVolverMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnVolverMenuActionPerformed(evt);
            }
        });

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "TIPO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        buttonGroup1.add(rdbTipo);
        rdbTipo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdbTipoActionPerformed(evt);
            }
        });

        cmbTipo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "(SELECCIONE)", "GARANTE", "GARANTIA HIPOTECARIA", "GARANTIA AUTOMOTRIZ", "GARANTIA WARRANT", "GARANTIA CDP", "TASACION HIPOTECARIA", "TASACION AUTOMOTRIZ", "TASACION WARRANT", "TASACION CDP", " " }));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(rdbTipo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cmbTipo, 0, 160, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(cmbTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(rdbTipo))
                .addContainerGap(17, Short.MAX_VALUE))
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "ACCION", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        buttonGroup1.add(rdbAccion);
        rdbAccion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdbAccionActionPerformed(evt);
            }
        });

        cmbAccion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "(SELECCIONE)", "INGRESO", "MODIFICACION", "ELIMINACION" }));

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(rdbAccion)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(cmbAccion, 0, 110, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(cmbAccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(rdbAccion))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "USUARIO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        buttonGroup1.add(rdbUsuario);
        rdbUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdbUsuarioActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(rdbUsuario)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtUsuario, javax.swing.GroupLayout.DEFAULT_SIZE, 110, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(rdbUsuario))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "PERFIL", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        buttonGroup1.add(rdbPerfil);
        rdbPerfil.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdbPerfilActionPerformed(evt);
            }
        });

        cmbPerfil.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "(SELECCIONE)", "ADMINISTRADOR", "GERENTE", "JEFE SUCURSAL", "SUPERVISOR", "EJECUTIVO" }));

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(rdbPerfil)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(cmbPerfil, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(cmbPerfil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(rdbPerfil))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btnListar.setText("LISTAR");
        btnListar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnListarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 791, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(btnVolverMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addGap(173, 173, 173)
                                    .addComponent(btnListar, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, Short.MAX_VALUE))))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(40, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(48, 48, 48)
                        .addComponent(btnListar)
                        .addGap(16, 16, 16)
                        .addComponent(btnVolverMenu))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 315, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        lblLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/IMAGE/logo.JPG"))); // NOI18N

        jLabel4.setFont(new java.awt.Font("Century Gothic", 1, 18)); // NOI18N
        jLabel4.setText("HISTORIAL");

        jLabel1.setText("MENÚ ADMINISTRADOR\\HISTORIAL");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lblLogo)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(211, 211, 211)
                        .addComponent(jLabel4))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel1)))
                .addGap(395, 395, 395))
            .addGroup(layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(17, 17, 17)
                        .addComponent(lblLogo))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(42, 42, 42)
                        .addComponent(jLabel4))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel1)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(47, 47, 47))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnVolverMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVolverMenuActionPerformed
        MenuAdministrador venMenuPrincipal = new MenuAdministrador(user);
        venMenuPrincipal.setVisible(true);
        Historial.this.dispose();
    }//GEN-LAST:event_btnVolverMenuActionPerformed

        
    private void btnListarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnListarActionPerformed
        if (rdbTipo.isSelected()) {
            ArrayList<HistorialDTO> salida = DAO.HistorialDAO.BuscarPorTipo(cmbTipo.getSelectedItem().toString());
            if (salida.isEmpty()) {
                javax.swing.JOptionPane.showMessageDialog(null, "No Hay informacion con ese Tipo");
            }
            else
            {
                DefaultTableModel modelo = (DefaultTableModel) this.jtInfo.getModel();
                modelo.setNumRows(0);
                for (HistorialDTO h : salida) {
                    Object[] arr = 
                    {
                        h.getCodigo(),
                        h.getUser(),
                        h.getNombre_usuario(),
                        h.getPerfil(),
                        h.getAccion(),
                        h.getTipo(),
                        h.getFecha(),
                        h.getHora(),
                        h.getFolio_ingresado(),
                        h.getRut_ingresado()
                    };
                    modelo.addRow(arr);
                }
            }
        }
        if (rdbAccion.isSelected()) {
            ArrayList<HistorialDTO> salida = DAO.HistorialDAO.BuscarPorAccion(cmbAccion.getSelectedItem().toString());
            if (salida.isEmpty()) {
                javax.swing.JOptionPane.showMessageDialog(null, "No Hay informacion con esa Accion");
            }
            else
            {
                DefaultTableModel modelo = (DefaultTableModel) this.jtInfo.getModel();
                modelo.setNumRows(0);
                for (HistorialDTO h : salida) {
                    Object[] arr = 
                    {
                        h.getCodigo(),
                        h.getUser(),
                        h.getNombre_usuario(),
                        h.getPerfil(),
                        h.getAccion(),
                        h.getTipo(),
                        h.getFecha(),
                        h.getHora(),
                        h.getFolio_ingresado(),
                        h.getRut_ingresado()
                    };
                    modelo.addRow(arr);
                }
            }
        }
        if (rdbUsuario.isSelected()) {
            ArrayList<HistorialDTO> salida = DAO.HistorialDAO.BuscarPorUsuario(txtUsuario.getText());
            if (salida.isEmpty()) {
                javax.swing.JOptionPane.showMessageDialog(null, "No Hay informacion con ese Usuario");
            }
            else
            {
                DefaultTableModel modelo = (DefaultTableModel) this.jtInfo.getModel();
                modelo.setNumRows(0);
                for (HistorialDTO h : salida) {
                    Object[] arr = 
                    {
                        h.getCodigo(),
                        h.getUser(),
                        h.getNombre_usuario(),
                        h.getPerfil(),
                        h.getAccion(),
                        h.getTipo(),
                        h.getFecha(),
                        h.getHora(),
                        h.getFolio_ingresado(),
                        h.getRut_ingresado()
                    };
                    modelo.addRow(arr);
                }
            }
        }
        if (rdbPerfil.isSelected()) {
            ArrayList<HistorialDTO> salida = DAO.HistorialDAO.BuscarPorPerfil(cmbPerfil.getSelectedItem().toString());
            if (salida.isEmpty()) {
                javax.swing.JOptionPane.showMessageDialog(null, "No Hay informacion con esa Perfil");
            }
            else
            {
                DefaultTableModel modelo = (DefaultTableModel) this.jtInfo.getModel();
                modelo.setNumRows(0);
                for (HistorialDTO h : salida) {
                    Object[] arr = 
                    {
                        h.getCodigo(),
                        h.getUser(),
                        h.getNombre_usuario(),
                        h.getPerfil(),
                        h.getAccion(),
                        h.getTipo(),
                        h.getFecha(),
                        h.getHora(),
                        h.getFolio_ingresado(),
                        h.getRut_ingresado()
                    };
                    modelo.addRow(arr);
                }
            }
        }
        if (rdbFecha.isSelected()) {
            String inicio = new SimpleDateFormat("yyyy/MM/dd").format(jDateDesde.getDate());
            String fin = new SimpleDateFormat("yyyy/MM/dd").format(jDateHasta.getDate());
            ArrayList<HistorialDTO> salida = DAO.HistorialDAO.BuscarPorRangoFecha(inicio, fin);
            if (salida.isEmpty()) {
                javax.swing.JOptionPane.showMessageDialog(null, "No Hay informacion entre esas fechas");
            }
            else
            {
                DefaultTableModel modelo = (DefaultTableModel) this.jtInfo.getModel();
                modelo.setNumRows(0);
                for (HistorialDTO h : salida) {
                    Object[] arr = 
                    {
                        h.getCodigo(),
                        h.getUser(),
                        h.getNombre_usuario(),
                        h.getPerfil(),
                        h.getAccion(),
                        h.getTipo(),
                        h.getFecha(),
                        h.getHora(),
                        h.getFolio_ingresado(),
                        h.getRut_ingresado()
                    };
                    modelo.addRow(arr);
                }
            }
        }   
    }//GEN-LAST:event_btnListarActionPerformed

    private void rdbTipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdbTipoActionPerformed
        if (rdbTipo.isSelected()) {
            EstadoControles(cmbTipo, null, null, null);
        }
    }//GEN-LAST:event_rdbTipoActionPerformed

    private void rdbAccionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdbAccionActionPerformed
        if (rdbAccion.isSelected()) {
            EstadoControles(cmbAccion, null, null, null);
        }
    }//GEN-LAST:event_rdbAccionActionPerformed

    private void rdbUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdbUsuarioActionPerformed
        if (rdbUsuario.isSelected()) {
            EstadoControles(null, txtUsuario, null, null);
        }
    }//GEN-LAST:event_rdbUsuarioActionPerformed

    private void rdbPerfilActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdbPerfilActionPerformed
        if (rdbPerfil.isSelected()) {
            EstadoControles(cmbPerfil, null, null, null);
        }
    }//GEN-LAST:event_rdbPerfilActionPerformed

    private void rdbFechaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdbFechaActionPerformed
        if (rdbFecha.isSelected()) {
            EstadoControles(null, null, jDateDesde, jDateHasta);
        }
    }//GEN-LAST:event_rdbFechaActionPerformed

    /**
     * @param args the command line arguments
     */
    /*public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        
        //</editor-fold>

        /*
         * Create and display the form
         */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//
//            public void run() {
//                new Historial().setVisible(true);
//            }
//        });
//    }
        
/** INACTIVA TODOS LOS CONTROLES Y LOS VA ACTIVADO CONFORME
  EL COMBOBOX QUE SE VAYA ACTIVANDO (DEL DISEÑO)*/
public void EstadoControles(JComboBox combo, JTextField texto, 
        JDateChooser cal1, JDateChooser cal2)
{
    cmbTipo.setEnabled(false);
    cmbAccion.setEnabled(false);
    cmbPerfil.setEnabled(false);
    txtUsuario.setEnabled(false);
    jDateDesde.setEnabled(false);
    jDateHasta.setEnabled(false);
    if (combo != null) {
        combo.setEnabled(true);
    }
    if (texto != null) {
        texto.setEnabled(true);
    }
    if (cal1 != null && cal2 != null) {
        cal1.setEnabled(true);
        cal2.setEnabled(true);
    }
}
    
public void TablaInicial()
{
    ArrayList<HistorialDTO> salida = DAO.HistorialDAO.HistorialCompleto();
    if (salida.isEmpty()) {
        javax.swing.JOptionPane.showMessageDialog(null, "Historial Vacio!");
    }
    else
    {
        DefaultTableModel modelo = (DefaultTableModel) this.jtInfo.getModel();
        modelo.setNumRows(0);
        for (HistorialDTO h : salida) {
            Object[] arr = 
            {
                h.getCodigo(),
                h.getUser(),
                h.getNombre_usuario(),
                h.getPerfil(),
                h.getAccion(),
                h.getTipo(),
                h.getFecha(),
                h.getHora(),
                h.getFolio_ingresado(),
                h.getRut_ingresado()
            };
         modelo.addRow(arr);
        }
    }
}


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnListar;
    private javax.swing.JButton btnVolverMenu;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JComboBox cmbAccion;
    private javax.swing.JComboBox cmbPerfil;
    private javax.swing.JComboBox cmbTipo;
    private com.toedter.calendar.JDateChooser jDateDesde;
    private com.toedter.calendar.JDateChooser jDateHasta;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable jtInfo;
    private javax.swing.JLabel lblLogo;
    private javax.swing.JRadioButton rdbAccion;
    private javax.swing.JRadioButton rdbFecha;
    private javax.swing.JRadioButton rdbPerfil;
    private javax.swing.JRadioButton rdbTipo;
    private javax.swing.JRadioButton rdbUsuario;
    private javax.swing.JTextField txtUsuario;
    // End of variables declaration//GEN-END:variables
}
